import java.util.Vector;


public class Process {
	
  public Integer PID;
  public int PC;	// Program Counter
  public int[] reg;	// general purpose registers
  public int[] flag;   // flags Z E L
  public final int Z = 0;
  public final int E = 1;
  public final int L = 2;
  public Integer LimitRegister;
  public Integer BaseRegister;
  public Vector<DiskFile> openFiles;
  public int processTime; //All process will have the same slice of time.
  
  Process(Integer pid, Integer br, Integer lt) 
  {
    
    PC = 0;
    PID = pid;
    reg = new int[16];
	flag = new int[3];
	LimitRegister = lt;
	BaseRegister = br;
	openFiles = new Vector<DiskFile>();
	processTime = 0;
  }
  
  public int addFileDescriptor(int diskid, int file)
  {
	  int fileDesc = -1;
	  DiskFile diskfile = new DiskFile(diskid, file);
	  if(openFiles.isEmpty())
		  fileDesc = 0;
	  else
		  fileDesc = openFiles.size(); //To know where diskfile will be
	  
	  openFiles.add(diskfile);
	  if(fileDesc < 0)
		  System.err.println("Error opening file");
		
	  return fileDesc;
	  
  }
  
  

}
